package phoenix.web.test_suites.foreigngirlfriend.critical;

import org.testng.annotations.DataProvider;
import org.testng.annotations.Test;

import phoenix.core.base.TestSuiteBase;
import phoenix.core.data_models.TestUserDataModel;
import phoenix.core.data_models.UserProfileDataModel.AboutMe;
import phoenix.core.data_models.UserProfileDataModel.LookingFor;
import phoenix.core.data_models.UserProfileDataModel.PaymentDetails;
import phoenix.core.data_models.UserProfileDataModel.ProfileDetails;
import phoenix.web.test_objects.BackendTests;
import phoenix.web.test_objects.FunnelTests;
import phoenix.web.test_objects.LoginTests;
import phoenix.web.test_objects.MyProfileTests;
import phoenix.web.test_objects.PaymentTests;
import phoenix.web.test_objects.RegistrationTests;
import phoenix.web.test_objects.UserPageTests;

/**
 * Test suite - Login and Logout tests
 */
public class CriticalTS extends TestSuiteBase
{
	// Tests
	private final RegistrationTests registrationTests = new RegistrationTests(phoenix);
	private final BackendTests backendTests = new BackendTests(phoenix);
	private final LoginTests loginTests = new LoginTests(phoenix);
	private final FunnelTests funnelTests = new FunnelTests(phoenix);
	private final PaymentTests paymentTests = new PaymentTests(phoenix);
	private final UserPageTests userPageTests = new UserPageTests(phoenix);
	private final MyProfileTests myProfileTests = new MyProfileTests(phoenix);

	@DataProvider
	public Object[][] registrationDataMale()
	{
		return registrationTests.dataProviders.registrationDataMale();
	}

	@DataProvider
	public Object[][] funnelData()
	{
		return funnelTests.dataProviders.funnelData();
	}

	@DataProvider
	public Object[][] loginData()
	{
		return loginTests.dataProviders.loginData();
	}

	@DataProvider
	public Object[][] myProfileData()
	{
		return myProfileTests.dataProviders.myProfileData();
	}

	@DataProvider
	public Object[][] userPageDataMale()
	{
		return userPageTests.dataProviders.interactionDataMale();
	}

	@DataProvider
	public Object[][] paymentData()
	{
		return paymentTests.dataProviders.paymentData();
	}

	@DataProvider
	public Object[][] userPageDataFemale()
	{
		return userPageTests.dataProviders.interactionDataFemale();
	}

	@Test(dataProvider = "registrationDataMale", groups = { "registration" }, priority = 1, enabled = true)
	public void registrationMaleTest(String p_userGender, String p_userEmail, String p_userPassword, String
			p_userBirthDay,
			String p_userBirthMonth, String p_userBirthYear)
	{
		registrationTests.registrationTest(p_userGender, p_userEmail, p_userPassword, p_userBirthDay,
				p_userBirthMonth, p_userBirthYear);

	}

	@Test(dependsOnMethods = { "registrationMaleTest" }, groups = { "registration" }, priority = 2, enabled = true)
	public void getUserDataTest()
	{
		backendTests.getUserDataTest(testUser().getEmail());
	}

	@Test(dependsOnMethods = "getUserDataTest", dataProvider = "loginData", groups = "login", priority = 3, enabled = true)
	public void loginUnConfirmedMaleTest(String p_userLogin, String p_userPassword)
	{
		loginTests.loginUnConfirmedTest(p_userLogin, p_userPassword);
	}

	@Test(dependsOnMethods = { "getUserDataTest" }, groups = { "registration" }, priority = 4, enabled = true)
	public void confirmationMaleTest()
	{
		funnelTests.confirmationTest();
	}

	@Test(dependsOnGroups = { "registration" }, dataProvider = "funnelData", groups = { "funnel" }, priority = 5, enabled = true)
	public void funnelMaleTest(String p_screenName, LookingFor p_lookingForParams, AboutMe p_aboutMeParams)
	{
		funnelTests.funnelTest(p_screenName, p_lookingForParams, p_aboutMeParams);
	}

	@Test(dependsOnGroups = { "registration" }, dataProvider = "myProfileData", groups = { "profile" }, priority = 7, enabled = true)
	public void saveDataAfterFunnelTest(ProfileDetails p_details, LookingFor p_lookingFunnel, AboutMe p_about, LookingFor p_lookingMyProfile)
	{
		myProfileTests.saveDataAfterFunnelTest(p_lookingFunnel, p_about);
	}

	@Test(dependsOnGroups = { "registration" }, dataProvider = "loginData", groups = { "login" }, priority = 8, enabled = true)
	public void loginConfirmedMaleTest(String p_userLogin, String p_userPassword)
	{
		loginTests.loginConfirmedTest(p_userLogin, p_userPassword);
	}

	@Test(dependsOnMethods = { "confirmationMaleTest" }, dataProvider = "paymentData", groups = { "male" }, priority = 9, enabled = true)
	public void paymentPackageTest(PaymentDetails p_paymentDataParams, boolean p_expectedResult)
	{
		paymentTests.paymentPackageTest(p_paymentDataParams, p_expectedResult);
	}

	@Test(dependsOnMethods = { "paymentPackageTest" }, groups = { "male" }, priority = 10, enabled = true)
	public void paymentFeaturesTest()
	{
		paymentTests.paymentFeaturesTest();
	}

	@Test(dependsOnMethods = { "paymentPackageTest" }, dataProvider = "userPageDataMale", groups = { "interaction" }, priority = 11, enabled = true)
	public void privateChatTest(TestUserDataModel p_userSender, TestUserDataModel p_userRecipient)
	{
		userPageTests.interactionsPrivateChatTest(p_userSender, p_userRecipient);
	}

	@Test(dependsOnMethods = { "paymentPackageTest" }, dataProvider = "userPageDataMale", groups = { "interaction" }, priority = 12, enabled = true)
	public void letterTest(TestUserDataModel p_userSender, TestUserDataModel p_userRecipient)
	{
		userPageTests.interactionLetterTest(p_userSender, p_userRecipient);
	}
}